package com.xiaochao.lcrapiddevelop.UI.test.Navigation;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.xiaochao.lcrapiddevelop.R;
import com.xuhc.bar.BottomNavigationBar;
import com.xuhc.bar.BottomNavigationItemWithDot;

/**
 * 底部导航栏（比较正统炫酷的）
 */
public class BottomNavigationActivity extends AppCompatActivity {

    private BottomNavigationBar bar;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bottom_navigation);
        bar = (BottomNavigationBar) findViewById(R.id.bar);
        bar.setOnNavigationItemSelectedListener(new BottomNavigationBar.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull BottomNavigationItemWithDot item, int selectedPosition) {
                bar.disMissNum(selectedPosition);
                return true;
            }

            @Override
            public void onNavigationItemSelectedAgain(@NonNull BottomNavigationItemWithDot item, int reSelectedPosition) {
                //reSelectedPosition 表示已选中之后再次点击该位置
                bar.showNum(reSelectedPosition, 2);
            }
        });
        bar.showNum(0, -1);
        bar.showNum(1, 86);
        bar.showNum(2, 120);

    }
}
